<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>五指山污水处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/logincss/layout.css" media="all">
</head>
<style>


</style>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <table class="layui-hide" id="zrcTable" lay-filter="zrcTables"></table>
</div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script type="text/html" id="table-zrc">
    <a class="layui-btn layui-btn-primary layui-btn-xs"  lay-event="info" style=" width: 90px;height: 25px;">详情</a>
</script>
<script>
    layui.use(['form', 'laydate', 'layer','table'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , layer = layui.layer
            , table = layui.table

        //自定义验证规则
        form.verify({
        });
        table.render({
            elem: '#zrcTable'
            , url:  "<%=request.getContextPath()%>/rest/base/getPhoneList"
            , height: 'full-200'
            , title: '乡镇列表'
            ,toolbar: false //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , cols: [[
                {field: 'xz', title: '乡镇', sort: true},
                {field: 'zrc', title: '自然村', sort: true},
                {title: '操作', toolbar: '#table-zrc'}
            ]]
            , text: {
                none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
            },
            // limits:[10, 20, 30, 40, 50],
            done: function (res, curr, count) {
                console.log(res)
                if (res.errorMsg == null) {

                } else {
                    layer.msg(res.errorMsg);
                }
            }
        })

        //监听工具条
        table.on('tool(zrcTables)', function (obj) {  //表格的lay-filter="userlists"
            var data = obj.data; //获得当前行所有数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
           $.ajax({
               type: "post",
               url: "<%=request.getContextPath()%>/rest/base/getPageBySelctId",
               data:{
                 selectTid:data.tid
               },
               async: false,
               success:function (){
                 window.location.href="<%=request.getContextPath()%>/phone/phoneInfo.jsp"
               }

           })
        });



    });
</script>
</body>
</html>